#include <bits/stdc++.h>
using namespace  std;
int n, k;

int main() {
	cin >> n >> k;
	vector<int> q;
	while (n--) {
		int t;
		cin >> t;
		if (t <= 5 - k) {
			q.push_back(t);
		}
	}
	cout << q.size() / 3 << endl;
	return 0;
}